package com.project.controller;

import com.project.bean.UserBean;
import com.project.service.IUserService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    private IUserService service;

    @RequestMapping("login")
    public String login(String username,String password){
        if (service.login(username,password)!=null){
            return "登陆成功";
        }else {
            return "登陆失败";
        }

    }

    @RequestMapping("add")
    public String add(UserBean user){
        service.add(user);
        return "添加成功"+user;
    }
}
